const mixin = {
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {},
    onShareTimeline() {},
    methods: {
        getAppInfo(cb) {
            // #ifdef APP-PLUS
            plus.runtime.getProperty(plus.runtime.appid, wgtinfo => {
                const info = {
                    //appid属性
                    appid: wgtinfo.appid,
                    //version属性
                    version: wgtinfo.version,
                    //name属性
                    name: wgtinfo.name,
                    //description属性
                    description: wgtinfo.description,
                    //author属性
                    author: wgtinfo.author,
                    //email属性
                    email: wgtinfo.email,
                    //features 属性
                    features: wgtinfo.features
                };
                if (cb) cb(info);
            });
            // #endif
        },
        getSystemInfo(cb) {
            uni.getSystemInfo({
                success(res) {
                    cb(res);
                }
            });
        },
        getClientInfo(cb) {
            // #ifdef APP-PLUS
            const clientInfo = plus.push.getClientInfo();
            if (cb) cb(clientInfo);
            return clientInfo;
            // #endif
        },
        preview(urls = [], current) {
            if (urls.length) {
                uni.previewImage({
                    urls: urls,
                    current,
                    // longPressActions: {
                    // 	itemList: ['发送给朋友', '保存图片', '收藏'],
                    // 	success: function(data) {
                    // 		console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
                    // 	},
                    // 	fail: function(err) {
                    // 		console.log(err.errMsg);
                    // 	}
                    // }
                });
            }
        },
    },
    data() {
        return {};
    }
};

export default mixin;
